<template>
	<z-paging ref="paging" v-model="list" @query="getList" loading-more-default-text="我也是有底线的哦">
		<view class="mainBg h100">
			<navbar title="我的发票" />
			<view class="list">
				<view class="col">
					<view class="col" v-for="item,index in list" :key="item.id">
						<item :item="item" @handleOpenS="handleOpenS" @handleOpenP="handleOpenP" :scene="scene" />
					</view>
				</view>
			</view>
		</view>
		<invoiceS ref="sInvoiceRef" :orderId="orderId" />
		<invoiceP ref="pInvoiceRef" :orderId="orderId" />
	</z-paging>
</template>

<script>
	import invoiceS from "./components/invoiceS.vue"
	import invoiceP from "./components/invoiceP.vue"
	import item from "./item.vue"
	export default {
		components: {
			item,
			invoiceP,
			invoiceS
		},
		data() {
			return {
				list: [],
				pageNo:1,
				pageSize:10,
				status:'success',
				scene:'invoice',
				orderId:'',
			}
		},
		methods: {
			getList(pageNo, pageSize) {
				this.$get(`/order/orderList`, {
					pageNum: this.pageNo,
					pageSize:this.pageSize,
					status:this.status,
				}).then(res => {
					//请勿在网络请求回调中给dataList赋值！！只需要调用complete就可以了
					this.$refs.paging.complete(res.data.rows);
				})
			},
			handleOpenS(orderId) {
				this.orderId = orderId
				this.$refs.sInvoiceRef.open()
			},
			handleOpenP(orderId) {
				this.orderId = orderId
				this.$refs.pInvoiceRef.open()
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #35CBAD;
	}

	.list {
		padding: 10rpx 0;

		.col {
			padding: 10rpx 0;
		}
	}
</style>